[IA64][MINIOS] Fixed some big-endian bugs and add HYPERVISOR_suspend
authorawilliam@xenbuild2.aw <awilliam@xenbuild2.aw>
Tue, 20 Mar 2007 15:51:45 +0000 (09:51 -0600)
committerawilliam@xenbuild2.aw <awilliam@xenbuild2.aw>
Tue, 20 Mar 2007 15:51:45 +0000 (09:51 -0600)
Signed-off-by: Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com>
extras/mini-os/arch/ia64/arch.mk
extras/mini-os/arch/ia64/common.c
extras/mini-os/arch/ia64/fw.S
extras/mini-os/arch/ia64/mm.c
extras/mini-os/arch/ia64/xencomm.c
extras/mini-os/include/ia64/hypercall-ia64.h

index 066fad36fdef6df3956bc3b24db32c40b1ba7a73..f1029de7bee597a306ed90689b94c1eb27758610 100644 (file)
@@ -1,3 +1,6 @@
+# Build for Big Endian?
+BIGENDIAN := n
+
 ARCH_CFLAGS := -mfixed-range=f2-f5,f12-f15,f32-f127 -mconstant-gp
 ARCH_CFLAGS += -O2
 ARCH_ASFLAGS := -x assembler-with-cpp
@@ -5,3 +8,13 @@ ARCH_ASFLAGS += -mfixed-range=f2-f5,f12-f15,f32-f127 -fomit-frame-pointer
 ARCH_ASFLAGS += -fno-builtin -fno-common -fno-strict-aliasing -mconstant-gp
 
 ARCH_LDFLAGS = -warn-common
+
+# Next lines are for big endian code !
+ifeq ($(BIGENDIAN),y)
+ARCH_CFLAGS += -mbig-endian -Wa,-mbe -Wa,-mlp64
+ARCH_CFLAGS += -DBIG_ENDIAN
+ARCH_ASFLAGS += -Wa,-mbe
+ARCH_ASFLAGS += -DBIG_ENDIAN
+ARCH_LDFLAGS = -EB -d
+endif
+
index 7d99a4c19123a5b137428050810a0a4ff37dd90d..13416d954263ce62c29fd14b3fed46dadb107b39 100644 (file)
@@ -225,6 +225,7 @@ arch_print_info(void)
        major = minor >> 16;
        minor &= ~0xffffffff;
        printk("Running on Xen version: %d.%d\n", major, minor);
+#if 0
        printk("machine addr of shared_info_t  : 0x%lx\n",
               start_info.shared_info);
        printk("machine page number of shared page: 0x%lx\n",
@@ -235,5 +236,8 @@ arch_print_info(void)
               start_info.console.domU.mfn);
        printk("evtchn for console messages    : %d\n",
               start_info.console.domU.evtchn);
-       printk("xen_guest_cmdline              : %s\n", boot_cmd_line);
+#endif
+       if(strlen(boot_cmd_line) > 0)
+               printk("xen_guest_cmdline              : %s\n", boot_cmd_line);
 }
+
index db89dfa934fab35844c6e209ba52275a7104acc3..48bb851e5d9cec8d9e71b89d453de003e577e864 100644 (file)
@@ -33,6 +33,7 @@
 #include "ia64_cpu.h"
 #include "ia64_fpu.h"
 #include "offsets.h"
+#include "xen/xen.h"
 
 
 /*
@@ -517,3 +518,23 @@ ENTRY(__hypercall)
        br.ret.sptk.many b0
        ;;
 END(__hypercall)
+
+/*
+ * Stub for suspend.
+ * Just force the stacked registers to be written in memory.
+ */
+ENTRY(xencomm_arch_hypercall_suspend)
+       ;;
+       alloc   r20=ar.pfs,0,0,6,0
+       mov     r2=__HYPERVISOR_sched_op
+       ;;
+       /* We don't want to deal with RSE.  */
+       flushrs
+       mov     r33=r32
+       mov     r32=2           // SCHEDOP_shutdown
+       ;;
+       break   0x1000
+       ;;
+       br.ret.sptk.many b0
+END(xencomm_arch_hypercall_suspend)
+
index dd1fb9dc7810e29ec827d99066d55feab08dd5c1..cb1699a9ab1d97fb753aeb8f4d7acabb5f26ab43 100644 (file)
@@ -127,7 +127,7 @@ void*
 map_frames(unsigned long* frames, unsigned long n)
 {
        n = n;
-       return (void*) __va(frames[0] << PAGE_SHIFT);
+       return (void*) __va(SWAP(frames[0]) << PAGE_SHIFT);
 }
 
 void arch_init_p2m(unsigned long max_pfn)
index 587576a0b4663e36899104dc413c55be5b1eff24..03d163cb9423cd414fbaec4100b5e8ac61e3bb7a 100644 (file)
@@ -171,13 +171,15 @@ xencommize_mini_grant_table_op(struct xencomm_mini *xc_area, int *nbr_area,
                        return -EINVAL;
                rc = xencomm_create_mini
                        (xc_area, nbr_area,
-                        xen_guest_handle(setup->frame_list),
-                        setup->nr_frames
+                        (void*)SWAP((uint64_t)
+                                    xen_guest_handle(setup->frame_list)),
+                        SWAP(setup->nr_frames)
                         * sizeof(*xen_guest_handle(setup->frame_list)),
                         &desc1);
                if (rc)
                        return rc;
-               set_xen_guest_handle(setup->frame_list, (void *)desc1);
+               set_xen_guest_handle(setup->frame_list,
+                                    (void *)SWAP((uint64_t)desc1));
                break;
        }
        case GNTTABOP_dump_table:
@@ -254,3 +256,15 @@ HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
        return xencomm_mini_hypercall_grant_table_op(cmd, uop, count);
 }
 
+       /* In fw.S */
+extern int xencomm_arch_hypercall_suspend(struct xencomm_handle *arg);
+int
+HYPERVISOR_suspend(unsigned long srec)
+{
+        struct sched_shutdown arg;
+
+        arg.reason = (uint32_t)SWAP((uint32_t)SHUTDOWN_suspend);
+
+        return xencomm_arch_hypercall_suspend(xencomm_create_inline(&arg));
+}
+
index 7b9b3edcc218e94c04893986feb22f930b50c2fb..2a4415879ded05fa3cf5a0f8a6615ff4306f01b9 100644 (file)
@@ -138,7 +138,7 @@ xencomm_arch_event_channel_op(int cmd, void *arg)
        if (unlikely(rc == -ENOSYS)) {
                struct evtchn_op op;
 
-               op.cmd = cmd;
+               op.cmd = SWAP(cmd);
                memcpy(&op.u, arg, sizeof(op.u));
                rc = _hypercall1(int, event_channel_op_compat, &op);
        }